package com.tiger.statefulsb.sample1;

import java.util.Vector;

public class ShoppingCartBean implements javax.ejb.SessionBean {
	private javax.ejb.SessionContext sessionContext = null;
	private Vector itemNameList = null;
	private Vector itemPriceList = null;

	public void setSessionContext(javax.ejb.SessionContext sessionContext) throws javax.ejb.EJBException, java.rmi.RemoteException {
		System.out.println("ShoppingCartBeanのsetSessionContextが呼ばれました");
		this.sessionContext = sessionContext;
	}

	public void ejbCreate() {
		System.out.println("ShoppingCartBeanのejbCreateが呼ばれました");
		this.itemNameList = new Vector();
		this.itemPriceList = new Vector();
	}

	public void add(String itemName, int itemPrice) {
		System.out.println("ShoppingCartBeanのaddが呼ばれました");
		System.out.println("商品名=" + itemName + ", 価格=" + itemPrice);
		this.itemNameList.addElement(itemName);
		this.itemPriceList.addElement(new Integer(itemPrice));
	}

	public void ejbActivate() {
		System.out.println("ShoppingCartBeanのejbActivateが呼ばれました");
	}

	public void ejbPassivate() {
		System.out.println("ShoppingCartBeanのejbPassivateが呼ばれました");
	}

	public void ejbRemove() {
		System.out.println("ShoppingCartBeanのejbRemoveが呼ばれました");
	}
}
